package me.firstapp.repository.weixin.member;

import java.util.Date;
import java.util.List;
import java.util.Map;

import me.firstapp.common.utils.Page;
import me.firstapp.module.weixin.member.Member;
import me.firstapp.repository.base.EntityRepository;

public interface MemberRepository extends EntityRepository<Member> {

	/**
	 * 通过openid查询会员
	 * 
	 * @param openId
	 * @return
	 */
	Member findMemberByOpenId(String openId);

	Member findMemberByCardNo(String cardNo);

	Member findByMobile(String mobile);

	Long findTotalFansCounts(String chiefOpenId);

	List<Member> findFansPage(Integer pageNo, Integer pageSize, String chiefOpenId);

	List<Member> findPartnerAgentPage(Integer pageNo, Integer pageSize, String partnerOpenId);

	List<Member> findMembersPage(Integer pageNo, Integer pageSize);

	List<Member> findMembersPage(Integer pageNo, Integer pageSize, List<Integer> levelList);

	List<Member> findMembersForRank(int limitCounts);

	List<Member> findNoPartnerAgentMembers(int limitCounts);

	Page<Member> findMemberPage(Integer pageNo, Integer pageSize, Map<String, Object> searchParams, String sortParam,
			String sortType, Date startTime, Date endTime, Integer vipLevel, String partnerOpenId);

	Long findPartnerCounts();

	List<Member> findFans(String chiefOpenId);
}
